/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package bpmn.impl;

import bpmn.ArtifactOutput;
import bpmn.BpmnPackage;
import bpmn.OutputSet;
import bpmn.Property;

import java.util.Collection;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.util.EObjectResolvingEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Output Set</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link bpmn.impl.OutputSetImpl#getArtifactOutputs <em>Artifact Outputs</em>}</li>
 *   <li>{@link bpmn.impl.OutputSetImpl#getPropertyOutputs <em>Property Outputs</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class OutputSetImpl extends SupportingElementImpl implements OutputSet {
	/**
	 * The cached value of the '{@link #getArtifactOutputs() <em>Artifact Outputs</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getArtifactOutputs()
	 * @generated
	 * @ordered
	 */
	protected EList<ArtifactOutput> artifactOutputs;

	/**
	 * The cached value of the '{@link #getPropertyOutputs() <em>Property Outputs</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPropertyOutputs()
	 * @generated
	 * @ordered
	 */
	protected EList<Property> propertyOutputs;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected OutputSetImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return BpmnPackage.Literals.OUTPUT_SET;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<ArtifactOutput> getArtifactOutputs() {
		if (artifactOutputs == null) {
			artifactOutputs = new EObjectResolvingEList<ArtifactOutput>(ArtifactOutput.class, this, BpmnPackage.OUTPUT_SET__ARTIFACT_OUTPUTS);
		}
		return artifactOutputs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Property> getPropertyOutputs() {
		if (propertyOutputs == null) {
			propertyOutputs = new EObjectResolvingEList<Property>(Property.class, this, BpmnPackage.OUTPUT_SET__PROPERTY_OUTPUTS);
		}
		return propertyOutputs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case BpmnPackage.OUTPUT_SET__ARTIFACT_OUTPUTS:
				return getArtifactOutputs();
			case BpmnPackage.OUTPUT_SET__PROPERTY_OUTPUTS:
				return getPropertyOutputs();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case BpmnPackage.OUTPUT_SET__ARTIFACT_OUTPUTS:
				getArtifactOutputs().clear();
				getArtifactOutputs().addAll((Collection<? extends ArtifactOutput>)newValue);
				return;
			case BpmnPackage.OUTPUT_SET__PROPERTY_OUTPUTS:
				getPropertyOutputs().clear();
				getPropertyOutputs().addAll((Collection<? extends Property>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case BpmnPackage.OUTPUT_SET__ARTIFACT_OUTPUTS:
				getArtifactOutputs().clear();
				return;
			case BpmnPackage.OUTPUT_SET__PROPERTY_OUTPUTS:
				getPropertyOutputs().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case BpmnPackage.OUTPUT_SET__ARTIFACT_OUTPUTS:
				return artifactOutputs != null && !artifactOutputs.isEmpty();
			case BpmnPackage.OUTPUT_SET__PROPERTY_OUTPUTS:
				return propertyOutputs != null && !propertyOutputs.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //OutputSetImpl
